#include_directories(${PROJECT_SOURCE_DIR}/include)
include_directories(.)

include_directories($ENV{PQXX_CSDK_INCL})
LINK_DIRECTORIES($ENV{PQXX_CSDK_LIB})

set (SRCS
    ${PROJECT_SOURCE_DIR}/src/topdbs_common.cpp
    ${PROJECT_SOURCE_DIR}/src/topdbs_base_session.cpp
    ${PROJECT_SOURCE_DIR}/src/topdbs_string.cpp
    ${PROJECT_SOURCE_DIR}/src/topdbs_field.cpp
    ${PROJECT_SOURCE_DIR}/src/topdbs_logutil.cpp
    pqxx_common.cpp
    pqxx_connection.cpp
    pqxx_session.cpp
    )    
    
#set(LIBRARY_OUTPUT_PATH ${CMAKE_BINARY_DIR}/lib)

if("${CMAKE_CXX_COMPILER_ID}" MATCHES "MSVC")
SET(CMAKE_WINDOWS_EXPORT_ALL_SYMBOLS TRUE)   
endif() 

add_library(topdbs_pqxx SHARED ${SRCS} )
if("${CMAKE_CXX_COMPILER_ID}" MATCHES "MSVC")
    target_link_libraries(topdbs_pqxx libpqxx libpq)
else()
    target_link_libraries(topdbs_pqxx  pqxx pq)
endif() 

install(TARGETS topdbs_pqxx DESTINATION ${LIBRARY_INSTALL_PATH})

set (HEADERS
    pqxx_common.hpp
    pqxx_transaction.hpp
    pqxx_connection.hpp
    pqxx_session.hpp
    )

install(FILES ${HEADERS} DESTINATION ${INCLUDE_INSTALL_PATH}/topdbs/postgresql)
